import random

class Player():
    '''
    Player that hunts with probability equal to percentage of last round cooperations.

    Naturally reduces to Tit for Tat when only one player remains.
    '''
    def __init__(self):
        self.name = "Product of Society"
        self.last_coop_pct = 1.0 #start idealistic

    def hunt_choices(
                    self,
                    round_number,
                    current_food,
                    current_reputation,
                    m,
                    player_reputations,
                    ):
                    
        return ['h' if random.random() < self.last_coop_pct else 's' for rep in player_reputations]
        

    def hunt_outcomes(self, food_earnings):
        self.last_coop_pct = sum([1 if payout >= 0 else 0 for payout in food_earnings])/float(len(food_earnings))  
        pass
        

    def round_end(self, award, m, number_hunters):
        pass
        